<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
    <%
            String basePath = "http://" + request.getLocalAddr() + ":" + request.getLocalPort() + request.getContextPath();
    %>
    <title>${promptInfo.totalDescInfo}</title>
    <head>
    <s:include value="../../head.jsp"></s:include>
    </head>
    <body >
        <form name="actionForm" method="post" action="decorateForwardAction.action?code=005" id="actionForm">
        <input type="hidden" name="imitateStep" value="sys_caseHistory_mgr_step_1">
            <script language="JavaScript" type="text/javascript">
            $(window.parent.document).find(".select").removeClass("select");
            $(window.parent.document).find("#pms2").addClass("select");
            var gridtb;
            $(document).ready(function(){	
           	$('#assessment').screenTB({
              	windowDocument:window.parent.document,
          		width:'250',
          		height:'150',
          		content:'确认',
          		contentAlign:'center',
          		contentValign:'middle',
          		title:'确认',
      			buttonValueYes:'确定',	
      			buttonValueNo:'取消',	
      			dialogType:'alert',
      			iframeSrc:''
          		},{
          		clickEvent:function(data){
      	    			if ($("#grid tbody input[type='checkbox']:checked").size() == 0){
      	    				data = $.extend(data,{content:'请选择病例！'});
      	    				return false;
      	    			} else if ($("#grid tbody input[type='checkbox']:checked").size() > 1 ) {
    	    				data = $.extend(data,{content:'不可一次选择多个病例！'});
    	    				return false;
        	    	    }
      	    			else{
      	    				var caseHistoryID="";
      	    				$("#grid tbody input[type='checkbox']:checked").each(function(){
      	    					caseHistoryID+=$(this).val()+",";
      	    				})
      	    				caseHistoryID = caseHistoryID.substring(0,caseHistoryID.length-1);
      	    				window.location.href = "decorateForwardAction.action?code=005001&paramMap.caseHistoryID="+caseHistoryID;
      	    				return true;
      	    			}
          			}
          		});
            	
            
            	$('#grid').gridTB(ujdata,ujoption,$('#pageNumContent'));
                    
            });
        	var ujoption = {
        			columnAlias:function(col,val){
				if(col == 'patientGender')
				{
					if (val == '1')
						val = "男";
					else if (val == '2')
						val =  "女";
					else 
						val = '未知';
				}
				 
				return val;
				},
        	columnClick:function(item,param){
					closeDiv();
		        	var kid  =  item.html();
		        	var dataParam = 'code=005010&paramMap.caseHistoryID='+kid;
					$.ajax({
						url:'ajaxAction.action',
						data:dataParam,
						dataType:	'json',
						success:function(data){
							var ass = data.data;
							var baseInfo = data.singleData;
							 
							var inht ='<div class="module"> <h2>病例信息 <span>上次更新时间：'+baseInfo.suptime+'</span></h2>';
							inht += '<div class="moduleCon">     <h3>病例基本信息</h3>     <table class="noBorder" border="0" cellpadding="0" cellspacing="0" width="100%">       <tbody><tr>  <th>病历编号：</th>';
							inht +=  '<td>'+baseInfo.caseHistoryID+'</td> <th>病人姓名：</th> <td>';
							inht += baseInfo.patientName+'	</td>         <th>性别：</th>         <td>'
							if(baseInfo.patientGender==1){
								inht += '男 ';
								}
							else if(baseInfo.patientGender==2){
								inht += '女 ';
								}
							else {
								inht += '其他 ';
								}
							inht +='</td>         <th>民族：</th>         <td>'+baseInfo.patientRelation+'</td>       </tr>';
							inht += '      <tr>         <th>身份证号：</th>         <td>'+baseInfo.patientCardID+'</td>         <th>年龄：</th>         <td>'+baseInfo.patientAge+'</td>         <th>职业：</th>         <td>'+baseInfo.patientJob+'</td>         <th>婚姻状况：</th>         <td>';
							inht += baseInfo.patientMaritalStatus==1?'已婚':'未婚' +'</td>       </tr>';
							inht +='      <tr>         <th>城市及区县：</th>         <td>'+baseInfo.patientCity+' '+baseInfo.patientDistrict+'</td>         <th>首次入院时间：</th>         <td colspan="5">'+baseInfo.caseHistoryCreateTime+'</td>       </tr>     </tbody></table>   </div>'
							inht +='  <div id="TabbedPanels" class="TabbedPanels">     <ul class="TabbedPanelsTabGroup">       <li class="TabbedPanelsTab TabbedPanelsTabSelected">病情评估</li>       <li class="TabbedPanelsTab">检查</li>       <li class="TabbedPanelsTab">治疗方案</li>       <li class="TabbedPanelsTab">疼痛日记</li>     </ul>';
							inht +=' <div class="TabbedPanelsContentGroup">       <div style="display: block;" class="TabbedPanelsContent TabbedPanelsContentVisible">';
							$.each(ass ,function(i){
									inht +='<strong>第'+ass[i].aaAsertTimes +'次测定：</strong><br />';
									inht +='<span>综合医院焦虑/抑郁（HAD）情绪测定 :        </span>    ';
									inht +='     （A）焦虑总分：'+ass[i].scoreA+'　　　　　　(D)抑郁总分：'+ass[i].scoreD+'<br/>';
								});
							inht+='</div>      <div style="display: none;" class="TabbedPanelsContent">2</div>       <div style="display: none;" class="TabbedPanelsContent">治疗方案</div>       <div style="display: none;" class="TabbedPanelsContent">疼痛日记</div>';
							inht +=' </div>   </div>   <div class="ctrl">     <button type="button" onclick="closeDiv()">关闭</button>     <div class="close"><a href="javaScript:closeDiv()">关闭</a></div>   </div> </div>'
							 
							$('#baseAssert').html(inht);
							$('#baseAssert').show();

							var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels");
									}
						})
		        	}
			};
            var ujdata = {
        		    globalParam:$("#actionForm").formSerialize(),
        		    //first,last
        	    	checkbox:{name:'选择',type:'first',width:'8%'},
        	    	columnDesc:{
        		    	//列表要显示的列（在json中对应的key）
        				showColumn: ['caseHistoryID','patientName','patientCardID','caseHistoryStatus','patientCity','patientAge','caseHistoryUpdateTime'],
        				//列表头显示名称
        				columnName:   ['病例编号','姓名','身份证','状态','城市','年龄','最近住院时间'],
        				//列表头宽度
        				columnWidth:   ['10%','10%','20%','10%','10%','10%','20%'],
        				//可以作为主键的类，在页面传送的过程中为paramMap.orgID=value的形式
        				//多个主键的时候为["orgID","orgCode"]:paramMap.orgID=value&paramMap.orgCode=value
        				primkeyColumn:['caseHistoryID'],
        				//要增加链接的列，可以为多个
        				linkColumn:[{name:'caseHistoryID',url:'getAssertInfo()',param:''}]
        	    	},		 
        	    	ajax:{
        	        	url:'ajaxAction.action',
        	        	data:'code=005'
        		    },
        		    //是否有分页工具条
        		    isPagination:'true',	    
        	    	paginationData:{
        				pageSize:'10'
        	    	}		    		 
        		};
            function search(){
            	ujdata = $.extend(ujdata,{globalParam:$("#actionForm").formSerialize(),ajax:{url:'ajaxAction.action',data:'code=005009'}});
            	$('#grid').gridTB(ujdata,ujoption,$('#pageNumContent'));
            }
            function closeDiv(){
            	$('#baseAssert').html("");
				$('#baseAssert').show();
                }
           </script>
            <div id="message__" class="showDiv">
</div>
<div id="screen__">
    <iframe id="iframeScreen__" scrolling="no" frameborder="0">
    </iframe>
</div>
            <div id="breadcrumb"><a href="#">首页</a> 〉病例管理</div>
            
             <div id="operation">
			    <ul class="operationMain">
			      <li><a href="decorateForwardAction.action?code=004" class="new">新建</a></li>
			      <li><a href="#" id="assessment" name="assessment" class="assessment" >病情评估</a></li>
			      <li><a href="#" class="check">检查</a></li>
			      <li><a href="#" class="plan">治疗方案</a></li>
			      <li><a href="#" class="date">疼痛日记</a></li>
			      <li><a href="#" class="visit">回访</a></li>
			      <li><a href="#" class="conclusion">诊断结论</a></li>
			      <li><a href="#" class="review">预览</a></li>
			      <li><a href="#" class="print">打印</a></li>
			    </ul>
			    <div class="search">
			    <span>请输入姓名:</span>
			      <input name="searchMap.patientName" id="userExtPhone"   type="text"   />
			      <button type="button" class="btNor" onclick="search();">搜索</button>
			    </div>
			  </div>
			  <div class="overlay broke-endless-pages" id="baseAssert" style="display:none"> </div>
             <div class="moduleCon">
   				 <table  width="99%"  class="row">
   				 <tr><td width="100%" id="grid"></td></tr>
   				 
             </table>
			    <table id="pageNumContent" width="99%"   class="pageNumContent" >
			    </table>
			  </div>
            
           
        </form>
    </body>
</HTML>
